﻿<Controls:SinacorWindow
    
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"    
    xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls"
    xmlns:Validation="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient.Validation;assembly=Sinacor.Infra.UI.Controls"
    xmlns:Edit="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient.Edit;assembly=Sinacor.Infra.UI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"    
    mc:Ignorable="d"    
    WindowStartupLocation="CenterScreen"
    WindowState="Maximized"
	Title="{DynamicResource FaturamentoBovespa.Movimento.Label.AcertoIRRF}"
	
	x:Class="Sinacor.UI.Bovespa.Movimento.View.SmartClient.AcertoIRRF"
    ModulePlus="False"
    ModuleId="BOL">

    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Controls:SinacorExpanderContainer Width="Auto" Height="Auto">
            <Controls:SinacorExpanderContainer.RowDefinitions>
                <RowDefinition Height="110" />
                <RowDefinition Height="*" />
            </Controls:SinacorExpanderContainer.RowDefinitions>
            <Controls:SinacorExpander Grid.Row="0"
                                      x:Name="ExpPesquisa"
									  HorizontalAlignment="Stretch"
									  VerticalAlignment="Stretch"
									  Header="{DynamicResource FaturamentoBovespa.Movimento.Label.Pesquisa}"
									  IsExpanded="True" 
									  Height="Auto">
                <Grid>
                    <Controls:SinacorLabel HorizontalAlignment="Left" 
						Content="{DynamicResource FaturamentoBovespa.Movimento.Label.CpfCnpj}" 
						Width="80" 
						Margin="0,25,0,0" 
						HorizontalContentAlignment="Left" />
                    <Controls:SinacorIdentificadorInvestidor HorizontalAlignment="Left" 
                       x:Name="txtFornecedorFiltro"
                       CPFBind="{Binding FiltroAcertoIRRF.CPFCNPJ}"                                      
                       CNPJBind="{Binding FiltroAcertoIRRF.CPFCNPJ}"                                      
					   Margin="0,46,0,0"
					   Width="230"
					   TabIndex="1" 
					   Height="21" 
					   VerticalAlignment="Top" 
					   ShowCPF="True" 
					   ShowCNPJ="True"/>
                    <Controls:SinacorLabel HorizontalAlignment="Left" 
					  	Content="{DynamicResource FaturamentoBovespa.Movimento.Label.Cliente}" 
					  	Width="70" 
					  	Margin="234,25,0,0" HorizontalContentAlignment="Left" />
                    <Controls:SinacorInt32TextBox HorizontalAlignment="Left" 
                        x:Name="txtClienteFiltro"   
                        Integers="7"
                        Value="{Binding FiltroAcertoIRRF.CodigoCliente}"
					  	Margin="234,46,0,0" 
					  	Width="80" 
                        IsFormated="False"
						TabIndex="2" 
						VerticalAlignment="Top"/>
                    <Controls:SinacorLabel 
					  	Content="{DynamicResource FaturamentoBovespa.Movimento.Label.TipoImposto}" 
					  	Width="130" 
					  	Margin="318,25,0,0" 
						HorizontalAlignment="Left" 
						HorizontalContentAlignment="Left" 
						IsTargetFieldRequired="True" />
                    <Controls:SinacorComboBox IsSynchronizedWithCurrentItem="True" 
                        x:Name="CboTipoImpostoFiltro"                       
                        SelectedValue="{Binding FiltroAcertoIRRF.TipoImposto}"                                                 
                        SelectedValuePath="Value"                      
                        DisplayMemberPath="Text"
					  	HorizontalAlignment="Left" 
						Margin="318,46,0,0" 
						VerticalAlignment="Top" 
						Width="176" 
						WidthPopup="300"
						TabIndex="3" />
                    <Controls:SinacorGroupBox Width="235"
								Height="67"
								Margin="498,0,0,0" 
								Header="{DynamicResource FaturamentoBovespa.Movimento.Label.Periodo}"
								HorizontalAlignment="Left" 
								VerticalAlignment="Top">
                        <Grid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,-9,0,0">
                            <Controls:SinacorLabel HorizontalAlignment="Left" 
										Content="{DynamicResource FaturamentoBovespa.Movimento.Label.De}"
										HorizontalContentAlignment="Left" 
										Width="55"/>
                            <Controls:SinacorDatePicker HorizontalAlignment="Left" 
                                                        x:Name="DtpDe"
                                                        Value="{Binding FiltroAcertoIRRF.Periodo.DataInicial}"
										Margin="0,21,0,0" 
										VerticalAlignment="Top" 
										TabIndex="4"/>
                            <Controls:SinacorLabel 
										Content="{DynamicResource FaturamentoBovespa.Movimento.Label.Ate}"
										Width="60" 
										HorizontalContentAlignment="Left" 
										HorizontalAlignment="Left" 
										Margin="109,0,0,0" 
										VerticalAlignment="Top"/>
                            <Controls:SinacorDatePicker HorizontalAlignment="Left" 
                                        x:Name="DtpAte"
                                        Value="{Binding FiltroAcertoIRRF.Periodo.DataFinal}"
										Margin="109,21,0,0" 
										VerticalAlignment="Top" 
										TabIndex="5"/>
                        </Grid>
                    </Controls:SinacorGroupBox>
                    <Controls:SinacorButton HorizontalAlignment="Left"
            			Margin="737,46,0,0"
            			Width="95"
            			Content="{DynamicResource FaturamentoBovespa.Movimento.Label.Pesquisar}"
                        x:Name="BtnPesquisar"
                        OnBufferedClick="BtnPesquisar_OnBufferedClick"
                        CausesValidation="True"
            			VerticalAlignment="Top"
            			IsDefault="True"
            			TabIndex="6" />
                    <Controls:SinacorButton HorizontalAlignment="Left"
                        x:Name="BtnNovaPesquisa"
                        OnBufferedClick="BtnNovaPesquisa_OnBufferedClick"
            			Margin="836,46,0,0"
            			Width="115"
            			Content="{DynamicResource FaturamentoBovespa.Movimento.Label.NovaPesquisa}"
            			VerticalAlignment="Top"
            			TabIndex="7" />
                </Grid>
            </Controls:SinacorExpander>
            <Controls:SinacorExpander Grid.Row="1"
									  HorizontalAlignment="Stretch"
									  VerticalAlignment="Stretch"
									  Header="{DynamicResource FaturamentoBovespa.Movimento.Label.AcertosCadastrados}"
									  IsExpanded="True" 
									  Margin="0,4,0,0" 
									  AllowExpand="False">
                <Grid>

                    <Controls:SinacorDataGrid x:Name="DtgAcertos"
                                              ItemsSource="{Binding ListaAcertosIRRF}"
                                              EndingInsert="DtgAcertos_EndingInsert"
                                              EndingUpdate="DtgAcertos_EndingInsert"
                                              UpdateBegun="DtgAcertos_UpdateBegun"
                                              InsertBegun="DtgAcertos_UpdateBegun"
                                              CancelingInsert="DtgAcertos_CancelingInsert"
                                              CancelingUpdate="DtgAcertos_CancelingInsert"
											  HorizontalAlignment="Stretch"
											  Width="Auto" 										
											  IsSynchronizedWithCurrentItem="True" 										
											  VerticalAlignment="Stretch" 										
											  Margin="0,0,0,0"											  
											  AllowCancelInsert="True"
											  AllowCancelUpdate="True"											 
											  AllowDelete="False"  
											  AllowSaveAll="False" 
											  AllowUndo="False" 
											  AllowUndoAll="False" 
											  AllowUndoLast="False"
											  SelectionMode="Single"
											  TabIndex="8" >
                        <Controls:SinacorDataGrid.Columns>
                            
                            <Controls:Column Name="Bolsa" 
    										 Title="FaturamentoBovespa.Movimento.Label.Bolsa"
                                             CellInsertTemplate="{Binding Path=CellUpdateTemplate, RelativeSource={RelativeSource Self}}"
                                             DisplayMemberPath="DescricaoBolsa"
                                             AllowInsert="True"
                                             HorizontalCellAlignment="Center"
                                             AllowUpdate="False">
                                <Controls:Column.CellUpdateTemplate>
                                <DataTemplate>
                                        <Controls:SinacorComboBox x:Name="CboBolsaGrid" 
                                                                     ItemsSource="{Binding Path=ListaBolsas}"
                                                                       DisplayMemberPath="NomeResumido"
                                                                     SelectedValuePath="CodigoBolsa">                                           
                                        </Controls:SinacorComboBox>
                                    </DataTemplate>
                                </Controls:Column.CellUpdateTemplate>
                            </Controls:Column>
                            
                            <Controls:Column Name="Cliente" 
    										 Title="FaturamentoBovespa.Movimento.Label.Cliente"
                                             CellInsertTemplate="{Binding Path=CellUpdateTemplate, RelativeSource={RelativeSource Self}}"
                                             DisplayMemberPath="CodigoCliente"
                                             Integers="7"
                                             HorizontalCellAlignment="Right"
                                             AllowInsert="True"
                                             AllowUpdate="False">
                               <Controls:Column.CellUpdateTemplate>
                                    <DataTemplate>
                                        <Controls:SinacorInt32TextBox x:Name="TxtClienteGrid" 
                                                                     Value="{Binding Path=CodigoCliente}"
                                                                      IsFormated="False"
                                                                      Integers="7"/>
                                    </DataTemplate>
                                </Controls:Column.CellUpdateTemplate>                                 
                            </Controls:Column>
                            
                            <Controls:Column Name="Pregao" 
    										 Title="FaturamentoBovespa.Movimento.Label.Pregao"
                                             CellInsertTemplate="{Binding Path=CellUpdateTemplate, RelativeSource={RelativeSource Self}}"
                                             DisplayMemberPath="DataPregao"
                                             HorizontalCellAlignment="Center"
                                             AllowInsert="True"
                                             AllowUpdate="False">
                                <Controls:Column.CellUpdateTemplate>
                                    <DataTemplate>
                                        <Controls:SinacorDatePicker x:Name="DtpPregaoGrid" 
                                                                     Value="{Binding Path=DataPregao}"/>
                                    </DataTemplate>
                                </Controls:Column.CellUpdateTemplate>
                            </Controls:Column>
                            
                            
                            <Controls:Column Name="DiasLiquidacao" 
    										 Title="FaturamentoBovespa.Movimento.Label.DiasLiq"
                                             CellInsertTemplate="{Binding Path=CellUpdateTemplate, RelativeSource={RelativeSource Self}}"
                                             DisplayMemberPath="DiasLiquidacaoAcerto.DiasLiquidacao"
                                             HorizontalCellAlignment="Center"
                                             AllowInsert="True"
                                             AllowUpdate="True">
                                <Controls:Column.CellUpdateTemplate>
                                <DataTemplate>
                                        <Controls:SinacorComboBox x:Name="CboDiasLiqGrid" 
                                                                     ItemsSource="{Binding Path=ListaDiasLiquidacaoAcerto}"
                                                                      SelectedValuePath="DiasLiquidacao"
                                                                      SelectedValue="{Binding DiasLiquidacao}"
                                                                     IsRequired="True"   
                                                                  >

                                            <Controls:SinacorComboBox.ItemTemplate>
                                                <DataTemplate>
                                                    <StackPanel Orientation="Horizontal">
                                                        <Controls:SinacorLabel Content="{Binding Path=DiasLiquidacao}"/>
                                                        <Controls:SinacorLabel Content=" - "/>
                                                        <Controls:SinacorLabel Content="{Binding Path=DescricaoTipoNota}"/>
                                                    </StackPanel>
                                                </DataTemplate>
                                            </Controls:SinacorComboBox.ItemTemplate>

                                        </Controls:SinacorComboBox>
                                    </DataTemplate>
                                </Controls:Column.CellUpdateTemplate>
                            </Controls:Column>
                            
                            
                            <Controls:Column Name="Liquidacao"                                              
    										 Title="FaturamentoBovespa.Movimento.Label.Liquidacao"                                             
                                             DisplayMemberPath="DataLiquidacao"
                                             AllowInsert="False"
                                             HorizontalCellAlignment="Center"
                                             AllowUpdate="False">                                
                            </Controls:Column>
                                                           
                            <Controls:Column Name="Origem" 
    										 Title="FaturamentoBovespa.Movimento.Label.Origem"                                              
                                             DisplayMemberPath="Origem"                                             
                                             AllowInsert="False"
                                             HorizontalCellAlignment="Center"
                                             AllowUpdate="False">                                
                            </Controls:Column>
                                
                            <Controls:Column Name="ValorBase" 
    										 Title="FaturamentoBovespa.Movimento.Label.ValorBase"                                             
                                             DisplayMemberPath="ValorBase"                                             
                                             AllowInsert="False"
                                             HorizontalCellAlignment="Right"                                             
                                             AllowUpdate="False">                                                               
                                
                            </Controls:Column>
                        
                            <Controls:Column Name="IrrfDT" 
    										 Title="FaturamentoBovespa.Movimento.Label.IrrfDt"                                            
                                             DisplayMemberPath="ValorRetido"
                                             CellInsertTemplate="{Binding Path=CellUpdateTemplate, RelativeSource={RelativeSource Self}}"
                                             AllowInsert="False"
                                             HorizontalCellAlignment="Right"
                                             AllowUpdate="False">                                    
                                
                            </Controls:Column>
                                                
                            <Controls:Column Name="AcertoBase" 
    										 Title="FaturamentoBovespa.Movimento.Label.AcertoBase"
                                             DisplayMemberPath="AcertoBase"
                                             CellInsertTemplate="{Binding Path=CellUpdateTemplate, RelativeSource={RelativeSource Self}}"
                                             AllowInsert="True"
                                             HorizontalCellAlignment="Right"
                                             AllowUpdate="True">

                                <Controls:Column.CellUpdateTemplate>
                                    <DataTemplate>
                                        <Controls:SinacorDecimalTextBox x:Name="TxtAcertoBaseGrid" 
                                                                     Value="{Binding Path=AcertoBase}"
                                                                      Integers="11"
                                                                        Decimals="2"/>
                                    </DataTemplate>
                                </Controls:Column.CellUpdateTemplate>
                            </Controls:Column>
                                                
                            <Controls:Column Name="AcertoIR" 
    										 Title="FaturamentoBovespa.Movimento.Label.AcertoIR" 
                                             DisplayMemberPath="AcertoIRRetido"
                                             CellInsertTemplate="{Binding Path=CellUpdateTemplate, RelativeSource={RelativeSource Self}}"
                                             AllowInsert="True"
                                             HorizontalCellAlignment="Right"
                                             AllowUpdate="True">
                                
                                <Controls:Column.CellUpdateTemplate>
                                    <DataTemplate>
                                        <Controls:SinacorDecimalTextBox x:Name="TxtAcertoIRRGrid" 
                                                                     Value="{Binding Path=AcertoIRRetido}"                                                                        
                                                                      Integers="11"
                                                                        Decimals="2"/>
                                    </DataTemplate>
                                </Controls:Column.CellUpdateTemplate>                                
                            </Controls:Column>
                                                        
                            <Controls:Column Name="CpfCnpj" 
    										 Title="FaturamentoBovespa.Movimento.Label.CpfCnpj" 
                                             DisplayMemberPath="CPFCNPJ" 
                                             HorizontalCellAlignment="Right"                                            
                                             AllowInsert="False"
                                             AllowUpdate="False">
                                                             
                            </Controls:Column>
                                                        
                            <Controls:Column Name="NascFund" 
    										 Title="FaturamentoBovespa.Movimento.Label.NascFund" 
                                             DisplayMemberPath="DataFundacao"                                              
                                             HorizontalCellAlignment="Center"
                                             AllowUpdate="False"
                                             AllowInsert="False">                                
                                          
                            </Controls:Column>                                                      
                                                        
                            <Controls:Column Name="Dependencia" 
    										 Title="FaturamentoBovespa.Movimento.Label.Dependencia" 
                                             DisplayMemberPath="CodigoDependencia"                                          
                                             HorizontalCellAlignment="Center"
                                             AllowUpdate="False"
                                             AllowInsert="False">                                
                                
                            </Controls:Column>
                            
                        </Controls:SinacorDataGrid.Columns>
                    </Controls:SinacorDataGrid>
                </Grid>
            </Controls:SinacorExpander>
        </Controls:SinacorExpanderContainer>
    </Grid>

</Controls:SinacorWindow>
